<template>
    <div>
        <table>
            <tr>
                <td>编号</td>
                <td>图书名称</td>
                <td>作者</td>
            </tr>
            <tr v-for="item in books">
                <td>{{item.id}}</td>
                <td>{{item.name}}</td>
                <td>{{item.author}}</td>
            </tr>
        </table>
        {{msg}}
    </div>
</template>

<script>
    export default {
        name: "Book",
        data(){
            return {
                msg: 'hello,vue',
                books: [
                    {
                        id:1,
                        name:'java',
                        author: 'coderchen'
                    },
                    {
                        id:2,
                        name:'python',
                        author: 'coderchen'
                    },
                    {
                        id:3,
                        name:'c++',
                        author: 'coderchen'
                    }
                ]
            }
        },
        created() {
            const _this=this;
           axios.get('http://localhost:8181/book/findAll').then(function (response) {
                _this.books=response.data
           })
        }
    }
</script>

<style scoped>

</style>